// Copyright (c) Microsoft Corporation
// All rights reserved

namespace Microsoft.Windows.Controls.Specialized.TextModel
{
    using System;

    /// <summary>
    /// Describes the contract for Text Reader implementors
    /// </summary>
    public interface ITextReader
    {
        /// <summary>
        /// Gets the specified length of text starting from the given index
        /// </summary>
        /// <param name="startIndex">
        /// The starting index to get the text from
        /// </param>
        /// <param name="length">
        /// The length of text to get
        /// </param>
        string GetText (int startIndex, int length);

        /// <summary>
        /// Gets text from the specified start index to the end of the text store
        /// </summary>
        /// <param name="startIndex">
        /// The starting index of the text to get
        /// </param>
        string GetText (int startIndex);

        /// <summary>
        /// Gets the entire text from the underlying text store
        /// </summary>
        string GetText ();

        /// <summary>
        /// Get a character from the specified index
        /// </summary>
        /// <param name="index">
        /// The index of the character to get
        /// </param>
        char GetChar(int index);

        /// <summary>
        /// Converts a range of text to a character array
        /// </summary>
        /// <param name="startIndex">
        /// The starting index of the range of text
        /// </param>
        /// <param name="length">
        /// The length of the text
        /// </param>
        char[] ToCharArray (int startIndex, int length);

        /// <summary>
        /// Converts the entire text into a character array
        /// </summary>
        char[] ToCharArray ();

        /// <summary>
        /// Copies a range of text to a destination character array.
        /// </summary>
        /// <param name="sourceIndex">
        /// The starting index to copy from
        /// </param>
        /// <param name="destination">
        /// The destination array
        /// </param>
        /// <param name="destinationIndex">
        /// The index into the array to start copying to
        /// </param>
        /// <param name="count">
        /// The number of characters to copy
        /// </param>
        void CopyTo (int sourceIndex, char[] destination, int destinationIndex, int count);

        /// <summary>
        /// Gets the Type of the document that the text in this text reader represents
        /// </summary>
        string DocumentType
        {
            get;
        }

        /// <summary>
        /// Gets the length of the text in the backing store
        /// </summary>
        int Length 
        { 
            get; 
        }

        /// <summary>
        /// Gets the number of lines in the backing store
        /// </summary>
        int LineCount 
        { 
            get; 
        }

        /// <summary>
        /// Gets the text buffer version that is associated with this text reader
        /// </summary>
        ITextVersion Version
        {
            get;
        }        
    }
}
